package edu.ccut.saturn.manager.bundles.core;

import org.osgi.framework.Bundle;

import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IParameterContext;
import edu.ccut.saturn.core.ServiceFactory;

public class QueryBundleInfo extends DefaultComponent {
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {
		String key = (String) parameterContext.getParameterValue(0);

		Bundle[] bundles = ServiceFactory.getBundleService().getBundles();

		for (Bundle bundle : bundles) {
			if (bundle.getSymbolicName().equals(key)) {
				parameterContext.setParameter(1, bundle);
			}
		}
	}
}